#include "SockClient.h"

SockClient::SockClient(IN CHAR *_servAddr, IN INT _servPort)
:Socket()
{
	hostent *he;
	if ((he = gethostbyname(_servAddr)) == 0) 
	{
		throw "Error";
	}

	sockaddr_in addr;
	addr.sin_family = AF_INET;
	addr.sin_port = htons(_servPort);
	addr.sin_addr = *((in_addr *)he->h_addr);
	memset(&(addr.sin_zero), 0, 8); 

	if (::connect(s_, (sockaddr *) &addr, sizeof(sockaddr))) 
	{
		throw "Error";
	}
}